Skip to content

Conversation

@baronfel
Copy link
Member

@baronfel baronfel commented Jul 1, 2025

Fixes #49615

The outer tool package will have all package types (McpServer, DotnetTool), but the inner packages will just have DotnetToolRidPackage. This prevents experiences like the MCP registry, which search based on "has PackageType of McpServer", from reporting the inner packages.

@Copilot Copilot AI review requested due to automatic review settings July 1, 2025 15:08
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that inner RID-specific tool packages only carry the DotnetToolRidPackage type while the outer tool package retains all specified package types, preventing inner packages from appearing in search-based experiences.

  • Extended TestToolBuilder to accept and embed additional package types into its package identifier.
  • Added an end-to-end test StripsPackageTypesFromInnerToolPackages to validate package types on both inner and outer tool packages.
  • Updated Microsoft.NET.PackTool.targets to conditionally set PackageType only for outer (DotnetTool) vs. inner (DotnetToolRidPackage) packages.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/Microsoft.DotNet.PackageInstall.Tests/TestToolBuilder.cs Added AdditionalPackageTypes setting and enhanced GetIdentifier
test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs New E2E test covering package-type stripping and related helpers
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets Conditional logic for outer vs. inner tool package type assignment
Comments suppressed due to low confidence (3)

test/Microsoft.DotNet.PackageInstall.Tests/EndToEndToolTests.cs:358

  • The assertion message only mentions 'DotnetTool' while the test expects DotnetTool plus additional types; consider updating the message to reference all expected package types or generalize it.
                .And.BeEquivalentTo(expectedPackageTypes, "The PackageType should be 'DotnetTool'.");

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets:388

  • MSBuild Condition expressions require == for equality checks; using a single = will not evaluate as intended. Update to Condition="$(_ToolPackageType) == 'DotnetTool'".
    <AddPackageType Condition="$(_ToolPackageType) = 'DotnetTool'" CurrentPackageType="$(PackageType)" PackageTypeToAdd="$(_ToolPackageType)">

src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.PackTool.targets:392

  • MSBuild Condition expressions require == for equality; update to Condition="$(_ToolPackageType) == 'DotnetToolRidPackage'" so the inner package rule applies correctly.
    <PropertyGroup Condition="$(_ToolPackageType) = 'DotnetToolRidPackage'">

@baronfel baronfel merged commit 67ab062 into dotnet:main Jul 2, 2025
26 checks passed
@baronfel baronfel deleted the strip-packagetypes-from-internal-multi-rid-tool-packages branch July 2, 2025 01:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-RID packages should strip all package types except DotnetToolRidPackage from the 'inner' packages

3 participants